home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / graphics / amicad / arexx_english / editscript.amicad < prev    next >
Text File  |  1999-12-06  |  2KB  |  54 lines

  1. /* EditScript.AmiCAD, Version 1.00e © R.Florac */
  2. /* This script is called for loading a script file in a text editor while working with AmiCAD */
  3. /* Push the CONTROL key while selecting an ARexx menu with AmiCAD
  4.  * to call it. The script must be in the AmiCAD/ARexx directory and
  5.  * must have the .AmiCAD extension to his name.
  6.  * This script is for my text editor Amitex, adapt it
  7.  * to any other text editor to suit to your needs.
  8. $VER: 1.1 (© R.Florac, 22/5/99) */
  9.  
  10. signal on error             /* for intercepting the errors */
  11. signal on syntax
  12.  
  13. options results
  14.  
  15. parse arg script            /* reads the script name */
  16.  
  17. if script = "" then do
  18.     'REQFILE("Script file to edit", "Work:AmiCAD/ARexx", "")'
  19.     script = result
  20.     if script="" then exit
  21. end
  22.  
  23. port = ADDRESS()                    /* reads the name of AmiCAD ARexx port */
  24.  
  25. address command
  26. if ~show(p, "AMITEX") then do       /* could be better (AMITEX0, AMITEX1...) */
  27.     f=0                 /* No window allready opened */
  28.     'run > nil:' "c:AmiTex"         /* loading the editor */
  29.     waitforport "AMITEX"
  30. end
  31. else f=1                /* the editor was allready running */
  32.  
  33. ADDRESS (AMITEX)
  34. cr='0a'x
  35.  
  36. if f=1 then 'NEW("")'               /* ask for opening a new window */
  37. if ~exists(script) then script=script||".AmiCAD"
  38.  
  39. 'LOAD("'script'")'                  /* loads the script file */
  40.  
  41. exit
  42.  
  43. /* Traitement des erreurs, interruption du programme */
  44. syntax:
  45. address (port)
  46. erreur=RC
  47. 'MESSAGE("Script EditScript.AmiCAD :"+CHR(10)+"Syntax error"+CHR(10)+"in line 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
  48. exit
  49.  
  50. error:
  51. address (port)
  52. 'MESSAGE("Script EditScript.AmiCAD :"+CHR(10)+"Error in line 'SIGL'")'
  53. exit
  54.